<?php

namespace App\Models\CarModels;

use App\Models\SystemManagement\Employee;
use Illuminate\Database\Eloquent\Model;

class CarAccidentRecord extends Model
{
    protected $table = 'car_accident_records';
    protected $fillable = ['record_time','agency','address','detail','desc','car_id','staff_id','record_id','repair_price','repair_address'];

    public function cars(){
        return $this->belongsTo(CarInfo::class,'car_id','id')->with('kind');
    }

    public function car(){
        return $this->belongsTo(CarInfo::class,'car_id','id')->with('kind');
    }
    public function staff(){
        return $this->belongsTo(Employee::class,'staff_id','id');
    }

    public function record(){
        return $this->belongsTo(Employee::class,'record_id','id');
    }
    public function detail(){
        return $this->belongsTo(CarAccidentRecordDetail::class,'record_id','id')->with('files');
    }
}
